<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
    <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/server.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<div class="panel admin-panel" id="app">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>

  <table class="table table-hover text-center">
    <tr>
      <th width="10%">ID</th>
      <th width="20%">图片</th>
      <th width="15%">文章的标题</th>
      <th width="20%">发表人</th>
       <th width="10%">发表时间</th>
      <th width="10%">点赞数</th>
      <th width="15%">操作</th>
    </tr>
   
    <tr v-for="article in  lists">
      <td>{{article.id}}</td>     
      <td><img v-bind:src="web_static_server+article.image" alt="" width="120" height="50" /></td>     
      <td>{{article.title}}</td>
      <td>{{article.nickname}}</td>
      <td>{{article.createdate}}</td>
      <td>{{article.star}}</td>
      <td><div class="button-group">
      <a class="button border-main" v-bind:href="'article.html?id='+article.id"><span class="icon-edit"></span> 详情</a>
      <a class="button border-red" href="javascript:void(0)" v-on:click="del(article.id)"><span class="icon-trash-o"></span> 删除</a>
      </div></td>
    </tr>
   
    
  </table>
</div>


</body>

<script type="text/javascript">
	//Hint表示提示对象 ，把提示信息封装到hint对象中
	var vue = new Vue({
		el : '#app',
		data : {
			lists : [],
			web_server:window.web_server,
			web_static_server:this.web_server+"/static/"
		},
		methods : {
			init : function() {
				var _self = this;
				//自定义 一个函数 ，用来查询所有的商品信息，返回Json
				$.get(_self.web_server+"/article/list", function(result) {
					if(result.code=="200"){
						_self.lists = result.data;
					}
				
				}, "json");
			},
			del:function(_id){
				var _self = this;
				if(confirm("您确定要删除吗?")){
					$.get(_self.web_server+"/article/delete",{id:_id}, function(result) {
							if(result.code=="200"){
									window.location.reload();
							}
					
					}, "json");
		
				}
				
			},
			find:function(_id){
				var _self = this;
				if(confirm("您确定要发货吗?")){
					$.get(_self.web_server+"/order/confirm",{id:_id}, function(result) {
							if(result.code=="200"){
									window.location.reload();
							}
					
					}, "json");
		
				}
				
			}

		}

	});
	//初始化Vue对象完毕之后，就调用init方法 （一进入页面，就显示数据）
	vue.init();
</script>


</html>